<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateO2oDiscountRelationTable1554107722 extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		$prefix = config('ibrand.app.database.prefix', 'ibrand_');

		if(!Schema::hasTable($prefix . 'o2o_discount_relation')){
			Schema::create($prefix . 'o2o_discount_relation', function (Blueprint $table) {
				$table->increments('id');
				$table->integer('discount_id');
				$table->integer('shop_id')->comment('门店id');
				$table->timestamps();
			});
		}
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		$prefix = config('ibrand.app.database.prefix', 'ibrand_');

		Schema::drop($prefix . 'o2o_discount_relation');
	}
}
